package io.renren.modules.canteens.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.canteens.dao.BatchOrdermxDao;
import io.renren.modules.canteens.dto.BatchOrderDTO;
import io.renren.modules.canteens.dto.BatchOrdermxDTO;
import io.renren.modules.canteens.entity.BatchOrderEntity;
import io.renren.modules.canteens.entity.BatchOrdermxEntity;
import io.renren.modules.canteens.service.BatchOrderService;
import io.renren.modules.canteens.service.BatchOrdermxService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 批量采购明细表 
 *
* @author 翟文闯 619556390@QQ.com
 * @since 1.0.0 2020-01-03
 */
@Service
public class BatchOrdermxServiceImpl extends CrudServiceImpl<BatchOrdermxDao, BatchOrdermxEntity, BatchOrdermxDTO> implements BatchOrdermxService {
   @Autowired
   private BatchOrdermxDao batchOrdermxDao;
    @Override
    public QueryWrapper<BatchOrdermxEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");

        QueryWrapper<BatchOrdermxEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);

        return wrapper;
    }


    @Override
    public BatchOrdermxDTO getTotalMoney(Long batchOrderId) {
        BatchOrdermxDTO totalMoney = batchOrdermxDao.getTotalMoney(batchOrderId);
        return totalMoney;
    }

    @Override
    public void delete1(Long batchOrdermxId) {
     batchOrdermxDao.delete1(batchOrdermxId);
    }
}